<?php
/**
 * Created by PhpStorm.
 * User: yuyiwen
 * Date: 2018/11/23
 * Time: 上午10:12
 */

$mem = new Memcache();
$res = $mem->connect('127.0.0.1' , '11211');

$val = '这是一个Memcache的测试.';
$key = md5($val);
$mem->set($key, $val, 0, 120); //增加插入一条缓存，缓存时间为120s

var_dump($mem->get(md5('这是一个Memcache的测试.')));